var webpack = require("webpack");
const path = require("path");
const name = "基础h5模板"; // page title
function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  publicPath: process.env.VUE_APP_PATH,
  outputDir: "dist", // 输出文件目录
  assetsDir: "static", // 设置打包的静态资源目录存放目录
  lintOnSave: false, // 设置是否在开发环境下每次保存代码时都启用 eslint验证
  productionSourceMap: false, // 生产环境是否生成 sourceMap 文件置端口号
  devServer: {
    host: process.env.VUE_APP_URL,
    port: 80,
    open: false,
    https: false,
    proxy: {
      //进行代理转发
      "/back/api": {
        // 转发的网址
        target: "http://114.116.196.151:8091",
        // 是否开启本地代理 默认truenpm run
        changeOrigin: true,
        secure: false,
      },
    },
    overlay: {
      warnings: false,
      errors: true,
    },
  }, // 开启临时服务器，运行vue项目
  configureWebpack: {
    performance: {
      hints: false,
    },
    name: name,
    resolve: {
      alias: {
        "@": resolve("src"), // 主目录
        views: resolve("src/views"), // 页面
        components: resolve("src/components"), // 组件
        api: resolve("src/api"), // 接口
        utils: resolve("src/utils"), // 通用功能
        assets: resolve("src/assets"), // 静态资源
        style: resolve("src/style"), // 通用样式
      },
    },
  },
  css: {
    // 开启 CSS source maps?
    sourceMap: false,
    // css预设器配置项
    // 启用 CSS modules for all css / pre-processor files.
    modules: false,
    loaderOptions: {
      less: {
        lessOptions: {
          modifyVars: {
            white: "#ffffff",
            lightgray: "#f3f3f3",
          },
        },
      },
    },
  },
};
